<template>
  <div class="selectOpen">
    <a-form-model layout="inline" :model="form" :rules="rules" ref="selectForm">
      <div>
        <a-form-model-item prop='likeName'>
          <a-input v-model="form.likeName" placeholder="名称搜索" />
        </a-form-model-item>
        <a-form-model-item prop='type'>
          <a-input v-model="form.type" placeholder="工程类型" />
        </a-form-model-item>
        <a-form-model-item>
          <a-button type="primary" @click="onSubmit">查询</a-button>
          <a-button style="margin-left: 10px;margin-right:15px" @click="resetForm">重置</a-button>

          <span v-if="open" @click="open=!open">
            <span class="colorBlue" style="margin-right:5px">展开</span>
            <a-icon type="up" class="colorBlue" />
          </span>
          <span v-else @click="open=!open">
            <span class="colorBlue" style="margin-right:5px">收起</span>
            <a-icon type="down" class="colorBlue" />
          </span>
        </a-form-model-item>
      </div>
      <div v-show="open">
        <a-form-model-item prop='a'>
          <a-input v-model="form.a" placeholder="工序" />
        </a-form-model-item>
        <a-form-model-item prop='b'>
          <a-input v-model="form.b" placeholder="管理项" />
        </a-form-model-item>
        <a-form-model-item prop='c'>
          <a-input v-model="form.c" placeholder="工程" />
        </a-form-model-item>
      </div>
    </a-form-model>
  </div>
</template>

<script>
export default {
  name: 'selectOpen',
  data() {
    return {
      form: {
        likeName: '',
        type: '',
        a: '',
        b: '',
        c: ''
      },
      open: false,
      rules: {
        // name: [{ required: true, message: '请输入名称搜索', trigger: 'blur' }],
        // type: [{ required: true, message: '请输入名称搜索', trigger: 'blur' }],
      }
    }
  },
  methods: {
    onSubmit() {
      // this.$refs.ruleForm.validate((valid) => {
      //   if (valid) {
          this.$emit('selectSearch',this.form)
      //   } else {
      //     return false
      //   }
      // })
    },
    resetForm() {
      // console.log(111);
      
      this.$refs.selectForm.resetFields()
    }
  }
}
</script>

<style lang="less" scoped>
.colorBlue {
  color: #1890ff;
  cursor: pointer;
  -webkit-user-select: none
}
.selectOpen{
  min-width: 650px;
}
</style>

